import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import Blogs from '../views/Blogs.vue'
import Edit from '../views/Edit.vue'
import Detail from '../views/Detail.vue'

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    redirect : '/blogs'
  },  {
    path: '/blogs',
    name: 'Blogs',
    component: Blogs
  }, {
    path: '/login',
    name: 'Login',
    component: Login
  }, {
    path: '/add',
    name: 'Edit',
    component: Edit
  },{
    path: '/edit/:id',
    name: 'Edit',
    component: Edit
  }, {
    path: '/detail/:id',
    name: 'Detail',
    component: Detail
  }
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
